package com.xjgzinfo.usdp.service.dto;

import com.xjgzinfo.usdp.jpa.service.Criteria;
import com.xjgzinfo.usdp.jpa.service.filter.Filter;
import com.xjgzinfo.usdp.jpa.service.filter.LongFilter;

import java.io.Serializable;
import java.util.Objects;

/**
 * Criteria class for the {@link com.xjgzinfo.usdp.domain.BladeVisualConfig} entity. This class is used
 * the Http GET request parameters.
 * For example the following could be a valid request:
 * {@code /blade-visual-configs?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
 * fix type specific filters.
 */
public class BladeVisualConfigCriteria implements Serializable, Criteria {

    private static final long serialVersionUID = 1L;

    private LongFilter id;

    private LongFilter visualId;

    public BladeVisualConfigCriteria() {
    }

    public BladeVisualConfigCriteria(BladeVisualConfigCriteria other) {
        this.id = other.id == null ? null : other.id.copy();
        this.visualId = other.visualId == null ? null : other.visualId.copy();
    }

    @Override
    public BladeVisualConfigCriteria copy() {
        return new BladeVisualConfigCriteria(this);
    }

    public LongFilter getId() {
        return id;
    }

    public void setId(LongFilter id) {
        this.id = id;
    }

    public LongFilter getVisualId() {
        return visualId;
    }

    public void setVisualId(LongFilter visualId) {
        this.visualId = visualId;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final BladeVisualConfigCriteria that = (BladeVisualConfigCriteria) o;
        return
                Objects.equals(id, that.id) &&
                        Objects.equals(visualId, that.visualId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                id,
                visualId
        );
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "BladeVisualConfigCriteria{" +
                (id != null ? "id=" + id + ", " : "") +
                (visualId != null ? "visualId=" + visualId + ", " : "") +
                "}";
    }

}
